<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <div v-if="!isLogin">
        <a href="javascript:void(0)">注册</a>
        <a href="javascript:void(0)" @click="isLogin=true">登录</a>
        <!--如果超链接点击时不离开此页面需要添加,需要费掉跳转功能-->
    </div>
    <div v-else>
        <input type="text" v-model="vl">
        <input type="button" value="添加" @click="arr.push(vl)">
        <a href="javascript:void(0)" @click="isLogin=false">登出</a>
    </div>
     <ul>
         <li v-for="name in arr">{{name}}</li>
     </ul>
</div>
<script src="../js/vue.js"></script>
<script>
     let v = new Vue({
         el:"body>div",
         data:{
             arr:["刘备","关羽"],
             isLogin:false,
             vl:""
         },
        /* methods:{
             f(){
                v.arr.push(v.vl);
             }
         }*/

     })
</script>
</body>
</html>